import { Card, Space } from 'antd';
import React from 'react';
import Link from 'components/ZLink';
import Poll from './poll'
const tabList = [
    {
        key: 'poll',
        tab: '轮询'
    },
    {
        key: 'upload',
        tab: '上传文件'
    }
]
export default () => {
    const [activeKey, setActiveKey] = React.useState('poll')
    
    const tabComponentList: any = {
        poll: <Poll />
    }
    return (
        <Space direction="vertical" style={{ width: '100%' }}>
            <Card title="相关链接">
                <Link href="http://www.ruanyifeng.com/blog/2018/07/web-worker.html" label="Web Worker 使用教程" />
            </Card>
            <Card 
                tabList={tabList}
                activeTabKey={activeKey}
                onTabChange={key => setActiveKey(key)}
            >
                {tabComponentList[activeKey]}
            </Card>
        </Space>
    )
}